<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>组织架构</title>
<%--    <link rel="stylesheet" type="text/css" href="/lib/ueditor/laydate.css"/>--%>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" type="text/css" href="../css/dept/deptManagement.css"/>
    <link rel="stylesheet" type="text/css" href="../lib/easyui/themes/easyui.css"/>
    <link rel="stylesheet" type="text/css" hcont_rigref="../lib/easyui/themes/icon.css"/>
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../css/news/center.css"/>
    <script type="text/javascript" src="../js/jquery/jquery-1.9.1.js"></script>
    <script src="../lib/laydate.js"></script>
    <script src="../js/jquery/jquery.cookie.js"></script>
<%--    <script src="/js/base/base.js"></script>--%>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <%--<script type="text/javascript" src="../lib/easyui/jquery.easyui.min.js"></script>--%>
    <%--<script type="text/javascript" src="../lib/easyui/tree.js"></script>--%>
    <%--<script type="text/javascript" src="../js/index.js"></script>--%>
    <%--<script src="../lib/layer/layer.js?20201106"></script>--%>
<%--    <script src="/js/street/base/base.js"></script>--%>
    <%--<script src="../lib/laydate.js"></script>--%>
    <title><fmt:message code="global.page.first" /></title>
    <style>
        html,
        body,
            /*.content{*/
            /*    margin-top:47px;*/
            /*}*/
        .wrap{
            width:100%;
            height:100%;
            /* overflow: hidden;*/
        }
        .noDatas {
            margin-top: 10px;
        }

        .noDatas_pic {
            margin-top: 20%;
        }

        .noData_out {
            margin: 0 auto;
            text-align: center;
        }

        .foot_span_show {
            float: right;
            color: white;
            line-height: 28px;
            margin-right: 15px;
            cursor: pointer
        }
        .head_rig  .import {
            width: 56px;
            height: 30px;
            font-size: 13px !important;
            cursor: pointer;
            background-repeat: no-repeat;
            background-image: url(../img/sys/import.png);
            padding-left: 25px;
        }
        .head_rig  .export {
            width: 56px;
            height: 30px;
            font-size: 13px !important;
            cursor: pointer;
            background-repeat: no-repeat;
            background-image: url(../img/sys/export.png);
            padding-left: 25px;
        }
        .head_rig .new_dept {
            width: 130px;
            height: 30px;
            font-size: 13px !important;
            background-image:url(../img/sys/dept_personnel.png);
            cursor: pointer;
            background-repeat: no-repeat;
            color: #fff;
        }

        #cont_left::-webkit-scrollbar {
            width: 0px;
        }

        #cont_left::-webkit-scrollbar-corner {
            /*background: #82AFFF;*/
        }

        .head_rig {
            width: 29%;
            margin-top: 0px;
            float: right;
        }
        .head_rig h1 {
            float: left;
            margin-right:20px;
        }

        .inp {
            height: 24px;
        }

        .search {
            width: 72px;
            height: 29px;
            margin-top: 16px;
            background: #fff;
        }

        .search h1 {
            text-align: center;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            background-image: url(../img/workflow/btn_check_nor_03.png);
            background-repeat: no-repeat;
        }

        .cont {
            width: 102%;
            height: 95%;
            overflow-y: auto;
        }

        .head {
            border-bottom: 1px solid #dedede;

        }
        .new_excell_pic {
            border-radius: 0;
            border: none;
            width: 73px;
            height: 73px;
            margin: 10px 24px 10px 20px;
        }

        .head_rig h1 :hover {
            cursor: pointer;
        }

        .deldel {
            color: #fff;
            font-size: 12px;
            float: right;
            margin-right: 10px;
            margin-left: 5px;
            line-height: 28px;
            cursor: pointer;
        }

        .footer_span_space {
            color: #fff;
            font-size: 12px;
            float: right;
            margin-right: 10px;
            line-height: 28px;
            cursor: pointer;
        }

        .foot_span_show {
            margin-left: 9px;
        }

        .edit {
            color: #fff;
            font-size: 12px;
            float: right;
            margin-right: 10px;
            margin-left: 5px;
            line-height: 28px;
            cursor: pointer;
        }

        .search h1 :hover {
            cursor: pointer;
        }

        .deldel_img {
            float: right;
            height: 15px;
            margin-top: 7px;
        }

        .edit_img {
            float: right;
            height: 15px;
            margin-top: 7px;
        }

        .deldel_yulan {
            float: right;
            height: 15px;
            margin-top: 7px;
            margin-right: 0px;
            cursor: pointer;
            margin-left: -4px;
        }

        .new_excell_footer {
            width: 100%;
            height: 28px;
            position: relative;
            background-color: #59bdf0;
        }

        .new_excell_head {
            position: relative;
            width: 100%;
            height: 30px;
        }

        .new_excell_name {
            border-left: 4px solid #59bdf0;
            color: #59bdf0;
            position: absolute;
            bottom: 0;
            font-size: 16px;
            font-weight: 700;
            height: 24px;
            margin-left: 20px;
        }

        .new_excell_info {
            width: 100%;
            height: 123px;
            position: relative;
        }

        .new_excell_center {
            margin-left: 6%;
            margin-top: 10px;
        }

        .new_excell_info_main {
            width: 100%;
            height: 62px;
            position: absolute;

        }

        .new_excell_info_other {
            position: absolute;
            top: 10px;
            height: 100%;
            margin-left: 45px;
            margin-top: 10px;
            list-style-type: none;
            left: 20%;
        }

        .new_excell_main {
            width: 332px;
            height: 181px;
            border: 1px solid #ddd;
            margin: auto;
            margin-top: 10px;
            border-radius: 5px;
        }

        .new_excell_main:hover {
            border: 2px solid #59bdf0;
        }

        .new_excell_info_mian_pic {
            float: left;
        }

        .new_excell {
            width: 360px;
            height: 191px;
            float: left;
            margin-left: 0px;
            margin-right: 0px;
        }

        .new_excell_info_other span {
            margin-left: 10px;
            color: black;
        }

        .new_excell_info_other li {
            height: 50%;
            line-height: 24px;
            font-size: 20px;
        }


        li {
            display: list-item;
            text-align: -webkit-match-parent;
        }

        .conter {
            width: 461px;
            height: 800px;
            margin: auto;
        }

        .f_field_title {
            display: inline-block;
            font-size: 12px;
            font-weight: bold;
            height: 18px;
            line-height: 41px;
            margin-left: 2px;
            margin-right: 2px;
        }

        .f_field_required {
            color: red;
            font-size: 12px;
            margin-top: 0px;
            margin-left: 2px;
            margin-right: 2px;
        }

        .f_field_ctrl {
            margin-top: 5px;
            margin-left: 2px;
            float: left;
        }

        select {

            height: 32px;
            width: 220px;
            border-radius: 4px;
            border: 1px solid #cccccc;
            background-color: #ffffff;
        }
        .cont_left li>span{
            display: block;
        }

        .f_field_title {
            font-size: 12px;
            font-weight: bold;
            margin-left: 2px;
            margin-right: 2px;
        }

        .f_field_required {
            color: red;
            font-size: 12px;
            margin-top: 0px;
            margin-left: 2px;
            margin-right: 2px;
        }

        .f_field_ctrl {
            margin-top: 5px;
            margin-left: 2px;
        }

        .f_field_ctrl input {
            color: #000;
        }

        .f_field_block {
            width: 100%;
            height: 68px;
            margin-top: 70px;
            margin-bottom: 4px;
            display: block;
            text-align: left;
        }

        .inp {
            width: 221px;
            height: 32px;
            border-radius: 4px;
        }


        .center {
            height: 400px !important;
        }

        .delete_flow, .edit_liucheng {
            cursor: pointer;
        }

        .layui-layer-title {
            padding: 0 80px 0 20px;
            height: 42px;
            line-height: 42px;
            border-bottom: 1px solid #eee;
            font-size: 16px;
            color: #fff;
            overflow: hidden;
            background-color: #2b7fe0;
            border-radius: 2px 2px 0 0;
        }

        .layui-layer-page .layui-layer-btn {
            padding-top: 10px;
            text-align: center;
        }
        .dpetWhole0{overflow: auto}
        dpetWhole0 li{white-space: nowrap;}
        .cont_rig {
            float: left;
            background-color: #f9f9f9;
        }
        .cont_left{
            border-right: 1px solid #c0c0c0!important;
        }

        html,body,.content{
            height:100%;
        }
        .headTop .head{
            border-bottom:0px;
        }
        .headTop {
            width: 100%;
            position: absolute;
            top: 0px;
            left: 0px;
            /*position: static;*/
            height: 47px;
            border-bottom: 1px solid #999;
            background: #fff;
            overflow: hidden;
        }
        .backg{
            background-color: #8E9DA6;
        }
        .add_back{
            background:#c3e7ff !important
        }
    </style>
</head>
<body style="overflow:scroll;overflow-y: hidden;overflow-x:hidden;">

<div class="wrap" style="margin-left:0px !important;">
    <div class="head">
        <div class="head_left">
            <img src="../img/sys/dept1.png" style="width: 25px;" alt="">
            <h1>组织架构</h1>
            <%--<h1>组织/成员单位管理</h1>--%>
        </div>
    </div>

    <div class="cont" style="overflow-y: auto ">
        <div class="cont_left" id="cont_left" style="    white-space: nowrap;">
            <ul>
                <li class="liDown dept_li" id="dept_lis"><img src="../img/sys/icon_sectorList.png" style="vertical-align: middle;width: 15px;margin-right: 10px;" alt="组织列表">组织列表</li>
                <li class="pick" style="display: block;">
                    <div class="pickCompany"><span style="height:35px;line-height:35px;" class="childdept"><img src="/img/spirit/icon_company.png" alt="" style="vertical-align: middle;width: 15px;margin-right: 10px;margin-left: 13px;margin-bottom: 4px;"><a href="javascript:void(0)" class="dynatree-title" title=""></a></span></div>
                </li>
            </ul>
        </div>

        <div class="cont_rig" style="position: relative;">
            <!-- 组织右侧页面 -->
            <%--<iframe class="content_iframe" id="iframe" style="width: 100%;height: 99%;" scrolling="no" src="/street/backlogjianjie" >--%>

            <%--</iframe>--%>
            <div class="headTop">
                <div class="head w clearfix">
                    <ul class="index_head">
                        <li data_id="0" data-num="0"><span class=" headli1_1 one">简介</span><img class="headli1_2" src="../img/twoth.png" alt=""/>
                        </li>
                        <li data_id="" data-num="1"><span class="headli2_1 ">党员信息 </span><img src="../img/twoth.png" alt="" class="headli2_2"/>
                        </li>

                    </ul>
                </div>


            </div>
            <div class="content" style="margin-top: 47px;">
                <iframe class="content_iframe" id="iframe" style="width: 99%;height: 95%;border: none;" scrolling="auto" src="/street/jianjie" >

                </iframe>
            </div>


        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    var loadSidebarUrl='';
    loadSidebarUrl="/orgDepartment/queryByDepIdList"
    boolTwo=false;
    numstring=true;
    //正在开发中
    function develop(me){
        $('.cont_rig').hide()
        $('.mainRight').show()
        $('.mainRight').height($(document).height()-$('.head').height())
        $('.mainRight').find('iframe').prop('src',$(me).attr('data-url'))
    };
    //编辑组织 详情
    function ajaxdata(id,me){
        $('.mainRight').hide()
        $('.cont_rig').show()
        $.ajax({
            url:'../orgDepartment/queryByIdOrgDepartmentWithBLOBs',
            type:'get',
            dataType:'json',
            data:{'deptId':id},
            success:function(data){

                $('#iframe').attr('data-id',id)
                var uid=""
                if(id==undefined){
                    uid=""
                }else{
                    uid=id;
                }
                $('#iframe').attr('src','/street/orgDepartmentCe?id='+id);
                $('.content_iframe').attr("src","/street/jianjie?id="+uid);
                $('.headli1_1').addClass("one")
                $('.headli2_1').removeClass("one")
            }
        })
    }
    //新建组织/成员单位按钮
    function newDept(){
        location.reload();
        $(".step1").show();
        $(".step2").hide();
    };
    $(function () {
        /*左侧点击事件显示隐藏*/
        boolTwo=false;
        $("#dept_lis").on('click', function () {

            if ($(this).siblings('.pick').css('display') == 'none') {
                $(this).siblings('.pick').show();
                $(this).addClass("liDown").removeClass("liUp");
            } else {
                $(this).siblings('.pick').hide();
                $(this).addClass("liUp").removeClass("liDown");
            }
        });
        // 编辑保存***********************
        $("#new_").on("click",function(){
//            alert($("#dapaId_").html());

            var deptParent_num = $('#deptParent_').attr('deptid').replace(/,/g,'');
            if(deptParent_num == ''){
                deptParent_num = 0;
            }
            var data = {
                'deptId':$("#dapaId_").html(),
                "deptNo":$("#deptNo_").val(),//  组织排序号
                "deptName": $("#deptName_").val(),    // 组织名称
                "telNo": $("#telNo_").val(),      //电话
                "faxNo":$("#faxNo_").val(),  //传真
                "deptAddress": $("#deptAddress_").val(),// 组织地址
                "deptParent":  deptParent_num,/*上级组织ID*/
                "isOrg": "", //是否是分支机构(0-否,1-是)
                "orgAdmin":"",//机构管理员
                "deptEmailAuditsIds":"", //保密邮件审核人
                "weixinDeptId":"",  // null
                "dingdingDeptId":"",//叮叮对应组织id
                "gDept":'',// 是否全局组织(0-否,1-是)
                "manager": $("#query_toId_").attr("dataid"),//组织主管
                "assistantId": $("#query_Satrap_").attr("dataid"),//组织助理
                "leader1": $("#query_UpAssistant_").attr("dataid"),//上级主管领导
                "leader2": $("#query_UpSatrap_").attr("dataid"),//上级分管领导
                "deptFunc":$("#deptFunc_").val(),//组织职能
                "avatar": "",    // 头像
                " userName": "",      // 用户名字
                "uid":"",  // 用户uid
                "userPrivName": "",// 用户角色名字
                "type":  "" //   返回类型

            };
            $.layerMsg({content:'修改成功！',icon:1},function(){
                $.ajax({
                    url:"<%=basePath%>../department/editDept",
                    type:'post',
                    dataType:"JSON",
                    data : data,
                    success:function(data){
                        location.reload();

                    },
                    error:function(e){
//                        console.log(e);
                    }
                });
            });

        });
        // 删除当前组织/成员单位按钮
        $("#delete_").on("click",function(){
            var data = {
                'deptId':$("#dapaId_").html(),
                "deptNo": $("#deptNo_").val()   // 组织排序号
            };
            /* 调用插件弹窗 */
            $.layerConfirm({title:'确定删除',content:'您确定要删除该组织吗？这将同时删除该组织下的所有下级组织和用户！',icon:0},function(){
                $.ajax({
                    url:"/department/deletedept",
                    type:'get',
                    dataType:"JSON",
                    data : data,
                    success:function(data){
                        if(data.flag){
                            location.reload();
                        }


                    },
                    error:function(e){
                        console.log(e);
                    }
                });
            },function(){
                return true;
            })
        });

        var boolTwo= false;
//        组织左侧数据渲染
//        <img src="/img/spirit/icon_company.png">
        loadSidebar1($('.pick'),0)

        function loadSidebar1(target,deptId,fn) {


            $.ajax({
                url: '/orgDepartment/queryByDepIdList',
                type: 'get',
                data: {
                    deptId: deptId
                },
                dataType: 'json',
                success: function (data) {
                    var str = '';
                    data.obj.forEach(function (v, i) {
                        if (v.deptName) {
                            str += '<li><span  data-numtrue="1" ' +
                                'onclick= "imgDownOrg(' +v.deptId + ',this)" data-types="1"  data-numString="1"  style="height:35px;line-height:35px;padding-left: 14px" deptid="' + v.deptId + '" class="childdept"><span class=""></span><img src="/img/sys/dapt_right.png" alt="" style="margin-left: 12px;width: 8px;height: 14px;margin-top: -3px;margin-right: 4px;"><a href="javascript:void(0)" class="dynatree-title" title="' + v.deptName + '">' + v.deptName + '</a></span><ul style="display:none;" class="dpetWhole0"></ul></li>';
                        }
                    })
                    widthnum++;
                    target.append(str);

                }
            })
        }
        $.ajax({
            url:'/sys/showUnitManage',
            type:'get',
            dataType:"JSON",
            data : '',
            success:function(obj){
                var data = obj.object.unitName;
                $('.pick .pickCompany .dynatree-title').text(data).attr('title',data);

            },
            error:function(e){
//                console.log(e);
            }
        })


        $('.cont_left').click(function (e) {
            var pid =$(e.target).parents("span").attr("deptid")
            $.cookie('meId',pid, { expires: 7 , path: '/' });
            // $('.content_iframe').attr("src","/street/backlogjianjie");
        })

        //选中标志
        /*        $('.dynatree-title').click(function(){
                 $('.dynatree-title').removeClass('.current');
                 $(this).addClass('.current');
                 });*/

//        右侧内容

        $('.headli1_1').click(function () {

            var uid=""
            if($('#iframe').attr('data-id')==undefined){
                uid=1
            }else{
                uid=$('#iframe').attr('data-id')
            }

            $('.content_iframe').attr("src","/street/jianjie?id="+uid);
            $('.headli1_1').addClass("one")
            $('.headli2_1').removeClass("one")

        });

        $('.headli2_1').click(function () {
            var uid=""
            if($('#iframe').attr('data-id')==undefined){
                uid=1
            }else{
                uid=$('#iframe').attr('data-id')
            }
            $('.headli2_1').addClass("one")
            $('.headli1_1').removeClass("one")


            $('.content_iframe').attr("src","/street/orgDepartmentCe?id="+uid);
        });

        // $('.headli3').click(function () {
        //     var uid=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         uid=1
        //     }else{
        //         uid=$('#iframe').attr('data-id')
        //     }
        //     $('.headli3').addClass("one")
        //     $('.headli2_1').removeClass("one")
        //     $('.headli1_1').removeClass("one")
        //     $('.headli4').removeClass("one")
        //     $('.headli5').removeClass("one")
        //     $('.headli6').removeClass("one")
        //     $('.headli7').removeClass("one")
        //     $('.content_iframe').attr("src","/street/yearScore?id="+uid);
        // });
        // $('.headli6').click(function () {
        //     var uid=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         uid=1
        //     }else{
        //         uid=$('#iframe').attr('data-id')
        //     }
        //     $('.headli6').addClass("one")
        //     $('.headli5').removeClass("one")
        //     $('.headli7').removeClass("one")
        //     $('.headli2_1').removeClass("one")
        //     $('.headli1_1').removeClass("one")
        //     $('.headli3').removeClass("one")
        //     $('.headli4').removeClass("one")
        //     $('.content_iframe').attr("src","/timeLineConmon/eventIndex?id="+uid);
        // });
        // $('.headli5').click(function () {
        //     var uid=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         uid=1
        //     }else{
        //         uid=$('#iframe').attr('data-id')
        //     }
        //     $('.headli5').addClass("one")
        //     $('.headli6').removeClass("one")
        //     $('.headli7').removeClass("one")
        //     $('.headli2_1').removeClass("one")
        //     $('.headli1_1').removeClass("one")
        //     $('.headli3').removeClass("one")
        //     $('.headli4').removeClass("one")
        //     $('.content_iframe').attr("src","/street/managerIndex1?id="+uid);
        // });
        // $('.headli4').click(function () {
        //     var uid=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         uid=1
        //     }else{
        //         uid=$('#iframe').attr('data-id')
        //     }
        //     $('.headli4').addClass("one")
        //     $('.headli2_1').removeClass("one")
        //     $('.headli1_1').removeClass("one")
        //     $('.headli3').removeClass("one")
        //     $('.headli5').removeClass("one")
        //     $('.headli6').removeClass("one")
        //     $('.headli7').removeClass("one")
        //     var id=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         id=1
        //     }else{
        //         id=$('#iframe').attr('data-id')
        //     }
        //     $('.content_iframe').attr("src","/street/subjectTheme?id="+id);
        // });
        // $('.headli7').click(function () {
        //     var uid=""
        //     if($('#iframe').attr('data-id')==undefined){
        //         uid=1
        //     }else{
        //         uid=$('#iframe').attr('data-id')
        //     }
        //     $('.headli7').addClass("one")
        //     $('.headli5').removeClass("one")
        //     $('.headli6').removeClass("one")
        //     $('.headli2_1').removeClass("one")
        //     $('.headli1_1').removeClass("one")
        //     $('.headli3').removeClass("one")
        //     $('.headli4').removeClass("one")
        //     $('.content_iframe').attr("src","");
        // });

        //        $('.cont_left').on('click',function (e) {
        //            $('.cont_left').find('li').removeClass('backg')
        //            var tag=e.target.nodeName
        //
        //            console.log(tag)
        //            if(tag=='A'){
        //                $(e.target).parent('span').parent('li').addClass('backg')
        //            }
        //        })

        $(document).delegate('.cont_left span','click',function () {
            $('.cont_left span').removeClass('add_back');
            $(this).addClass('add_back');
        })

    });
    function imgDownOrg(deptNum, me) {
        ajaxdata(deptNum, me);
        if ($(me).attr('data-types') == undefined) {
            $(me).find('img').attr('src', $(me).find('img').attr('src') == '/img/sys/dapt_right.png' ? '/img/sys/dapt_down.png' : '/img/sys/dapt_right.png');
            if ($(me).find('img').attr('src') == '/img/sys/dapt_right.png') {
                $(me).find('img').css({"margin-top": "-3px", "margin-right": "4px", "margin-left": ""});
                $(me).find('img').width(8);
                $(me).find('img').height(14);
                $(me).next().hide();
                // $(me).next().html('')
            } else if ($(me).find('img').attr('src') == '/img/sys/dapt_down.png') {
                $(me).find('img').css({"margin-top": "-3px", "margin-right": "4px", "margin-left": "-5px"});
                $(me).find('img').width(14);
                $(me).find('img').height(9);
                $(me).next().show();
            }
        }
        else {
            $(me).find('img').attr('src', $(me).find('img').attr('src') == '/img/sys/dapt_right.png' ? '/img/sys/dapt_down.png' : '/img/sys/dapt_right.png');
            if ($(me).find('img').attr('src') == '/img/sys/dapt_right.png') {
                $(me).find('img').width(8);
                $(me).find('img').height(14);
            } else if ($(me).find('img').attr('src') == '/img/sys/dapt_down.png') {
                $(me).find('img').width(14);
                $(me).find('img').height(9);
            }
            if ($(me).attr('data-types') == '1') {
                $(me).next().show();
                $(me).attr('data-types', '2')
            } else if ($(me).attr('data-types') == '2') {
                $(me).next().hide();
                $(me).attr('data-types', '1')
            }
        }

        $('#btn').attr('data_id',deptNum);

        if ($(me).attr('data-numstring') == 1) {
            if (boolTwo) {
                if ($(me).next().css('display') == 'none') {
                    return;
                }
                $.loadrole($(me).next(), deptNum, $(me).attr('data-numtrue'));
            } else {
                loadSidebarOrg($(me).next(), deptNum)
            }
        }
        if($(me).next().html()=='') {
            if (boolTwo) {
                $.loadrole($(me).next(), deptNum, $(me).attr('data-numtrue'), function () {
                    if (departments) {
                        $.loadSidebar($(me).next(), deptNum)
                    }
                })
            }
        }
        if ($(me).attr('data-numstring') == 2) {
            if (numstring) {
                $.loadSidebar($(me).next(), deptNum)
            }
        }
    }

    function loadSidebarOrg(target, deptId, fn) {
        $.ajax({
            url: '/orgDepartment/getChDept',
            type: 'get',
            data: {
                deptId: deptId
            },
            dataType: 'json',
            success: function (data) {
                showDept(data);
                if (deptId == 0) {
                    var str = '';
                    if ($(target).children('li').length == 0) {
                        data.obj.forEach(function (v, i) {
                            if (v.orgDeptName) {
                                str += '<li><span data-types="1" data-numstring="1"   data-numtrue="1" ' +
                                    'onclick= "imgDownOrg(' + v.orgDeptId + ',this)"  ' +
                                    'style="height:35px;line-height:35px;padding-left: 14px" ' +
                                    'deptid="' + v.orgDeptId + '" class="childdept"><span class="">' +
                                    '</span><img src="/img/commonTheme/${sessionScope.InterfaceModel}/icon_company.png" alt="" ' +
                                    'style="vertical-align: middle;width: 15px;' +
                                    'margin-right: 10px;margin-left:15px;">' +
                                    '<a href="javascript:void(0)" ' +
                                    'class="dynatree-title" title="' + v.orgDeptName + '">' + v.orgDeptName + '</a>' +
                                    '</span><ul style="display:none;" class="dpetWhole0"></ul></li>';
                            }
                        })
                        target.html(str);
                    } else {
                        $(target).children('li').each(function (v, l) {
                            for (var i = 0; i < data.obj.length; i++) {
                                if ($($(target).children('li')[i]).children('span').attr('deptid') != data.obj[i].deptId) {
                                    if (v.orgDeptName) {
                                        str = '<li><span data-types="1" data-numstring="1"   data-numtrue="1" ' +
                                            'onclick= "imgDownOrg(' + data.obj.orgDeptId + ',this)"  ' +
                                            'style="height:35px;line-height:35px;padding-left: 14px" ' +
                                            'deptid="' + data.obj.orgDeptId + '" class="childdept">' +
                                            '<span class="">' +
                                            '</span><img src="/img/commonTheme/${sessionScope.InterfaceModel}/icon_company.png" alt="" ' +
                                            'style="vertical-align: middle;width: 15px;' +
                                            'margin-right: 10px;margin-left:15px;">' +
                                            '<a href="javascript:void(0)" ' +
                                            'class="dynatree-title" title="' + data.obj.orgDeptName + '">' + data.obj.orgDeptName + '</a>' +
                                            '</span><ul style="display:none;" class="dpetWhole0"></ul></li>';
                                    }
                                    $(target).append(str)
                                }
                            }
                            return false
                        })
                    }
                    widthnum++;
                    if (fn != undefined) {
                        fn($(target).find('.dpetWhole0'))
                    }
                } else {
                    var str = '';
                    if ($(target).children('li').length == 0) {
                        data.obj.forEach(function (v, i) {
                            var targetnum = parseInt($(target).prev().attr('data-numtrue'))

                            if (v.orgDeptName && v.isHaveCh == 1) {
                                str += '<li><span  onclick= "imgDownOrg(' + v.orgDeptId + ',this)" ' +
                                    'data-numString="2" deptid="' + v.orgDeptId + '" ' +
                                    'data-numtrue="' + (targetnum + 1) + '"  ' +
                                    'style="padding-left:' +
                                    (20 + (20 * parseInt($(target).prev().attr('data-numtrue')))) + 'px;' +
                                    'height:35px;line-height:35px;"  deptid="' + v.orgDeptId + '" class="childdept">' +
                                    '<span></span><img id="img' + v.orgDeptId + '" src="/img/sys/dapt_right.png" ' +
                                    'style="width: 8px;height:14px;margin-top: -3px;margin-right:4px;" alt="">' +
                                    '&nbsp;<a href="javascript:void(0)" class="dynatree-title" ' +
                                    'title="' + v.orgDeptName + '">' + v.orgDeptName + '</a></span>' +
                                    '<ul style="display:none;"></ul></li>';
                            } else {
                                str += '<li>' +
                                    '<span onclick="imgDownOrg(' + v.orgDeptId + ',this)" ' +
                                    'data-numString="1" deptid="' + v.orgDeptId + '" ' +
                                    'data-numtrue="' + (targetnum + 1) + '" ' +
                                    'style="padding-left:' + (20 + (20 *
                                        parseInt($(target).prev().attr('data-numtrue')))) + 'px;' +
                                    'height:35px;line-height:35px;"  deptid="' + v.orgDeptId + '" ' +
                                    'class="childdept"><span></span><img  src="/img/sys/dapt_right.png" ' +
                                    'style="width: 8px;height:14px;margin-top: -3px;margin-right:4px;" ' +
                                    'alt="">&nbsp;<a href="javascript:void(0)" class="dynatree-title" ' +
                                    'title="' + v.orgDeptName + '">' + v.orgDeptName + '</a></span><ul ' +
                                    'style="display:none;"></ul></li>';
                            }

                        });
                        target.html(str);
                    } else {
                        $(target).children('li').each(function (v, l) {

                            for (var i = 0; i < data.obj.length; i++) {



                                if ($($(target).children('li')[i]).children('span').attr('deptid') != data.obj[i].orgDeptId) {

                                    var targetnum = parseInt($(target).prev().attr('data-numtrue'))

                                    if (data.obj[i].orgDeptName && data.obj[i].isHaveCh == 1) {
                                        str = '<li><span  onclick= "imgDownOrg(' + data.obj[i].orgDeptId + ',this)" ' +
                                            'data-numString="2" deptid="' + data.obj[i].orgDeptId + '" ' +
                                            'data-numtrue="' + (targetnum + 1) + '"  ' +
                                            'style="padding-left:' +
                                            (20 + (20 * parseInt($(target).prev().attr('data-numtrue')))) + 'px;' +
                                            'height:35px;line-height:35px;"  deptid="' + data.obj[i].orgDeptId + '" class="childdept">' +
                                            '<span></span><img id="img' + data.obj[i].orgDeptId + '" src="/img/sys/dapt_right.png" ' +
                                            'style="width: 8px;height:14px;margin-top: -3px;margin-right:4px;" alt="">' +
                                            '&nbsp;<a href="javascript:void(0)" class="dynatree-title" ' +
                                            'title="' + data.obj[i].orgDeptName + '">' + data.obj[i].orgDeptName + '</a></span>' +
                                            '<ul style="display:none;"></ul></li>';
                                    } else {
                                        str = '<li>' +
                                            '<span onclick="imgDownOrg(' + data.obj[i].orgDeptId + ',this)" ' +
                                            'data-numString="1" deptid="' + data.obj[i].orgDeptId + '" ' +
                                            'data-numtrue="' + (targetnum + 1) + '" ' +
                                            'style="padding-left:' + (20 + (20 *
                                                parseInt($(target).prev().attr('data-numtrue')))) + 'px;' +
                                            'height:35px;line-height:35px;"  deptid="' + data.obj[i].orgDeptId + '" ' +
                                            'class="childdept"><span></span><img  src="/img/sys/dapt_right.png" ' +
                                            'style="width: 8px;height:14px;margin-top: -3px;margin-right:4px;" ' +
                                            'alt="">&nbsp;<a href="javascript:void(0)" class="dynatree-title" ' +
                                            'title="' + data.obj[i].deptName + '">' + data.obj[i].deptName + '</a></span><ul ' +
                                            'style="display:none;"></ul></li>';
                                    }
                                    $(target).append(str)
                                }
                            }
                            return false;
                        })
                    }
                    widthnum++
                    if (fn != undefined) {
                        fn();
                    }
                }
            }
        })
    }
    function showDept(reg) {
        var data=reg.obj;
        //console.log(data);
        var str="";
        for(var i=0;i<data.length;i++){
            // var imgL=data[i].attachmentList;
            // var img=""
            // for(var h=0;h<imgL.length;h++){
            //     img +=   '<img src="/xs?'+imgL[h].attUrl+'" alt="" onclick="javascript:window.open(this.src)" style="width: 40px;height: 40px;margin-right: 10px;">'
            // }
            str+='  <tr id="'+data[i].orgDeptId+'">' +
                //                            '                    <td>' +
                //                            '                        <input type="checkbox" class="childCheck">' +
                //                            '                    </td>' +
                '                    <td>'+data[i].orgDeptNo+'</td>' +
                '                    <td><a href="javascript:;" class="choose" data-type="1">'+function(){
                    if(data[i].orgDeptName==undefined){
                        return ''
                    }else{
                        return data[i].orgDeptName;
                    }
                }()+'</a></td>' +
                // '                    <td><a href="javascript:;" class="choose" data-type="1">'+datas[i].activitySubject+'</a></td>' +
                '                    <td>'+data[i].gridLocation+'</td>' +
                // '                    <td>'+datas[i].assessmentTeamaudit+'</td>' +
                // '                    <td>'+datas[i].score+'</td>' +
                '                    <td>' +
                /* '                        <a href="javascript:;" class="choose" data-type="1">查看</a>' +*/
                '                        <a href="javascript:;" class="choose" data-type="2">修改</a>' +
                '                        <a href="javascript:;" class="del">删除</a>' +
                '                    </td>' +
                '                </tr>'
        }
        $('.list').html(str);
        if(reg.total>10){
            $('#dbgz_page').show();
            me.pageTwo(reg.total,me.data.pageSize,me.data.page)
        } else {
            $('#dbgz_page').hide();
        }
    }
</script>

</html>
